'use strict';

var demo = angular.module('myApp', [
    'ngRoute',
    'myApp.home',
    'myApp.view1',
    'myApp.view2',
    'myApp.login'
]);

demo.config(['$routeProvider', function ($routeProvider) {
    $routeProvider.otherwise({redirectTo: '/home'});
}]);
demo.config(function ($httpProvider) {
    //设置默认请求头
    $httpProvider.defaults.headers
        .common['X-Requested-By'] = 'MyAngularApp';
});
/*
 demo.config(['$httpProvider', '$cacheFactory', function ($httpProvider, $cacheFactory) {
 $httpProvider.defaults.cache = $cacheFactory('myCache', {
 capacity: 20
 });
 }]);
 */
demo.factory("serData", function ($http) {
    return $http({
        method: 'GET',
        url: 'data/data.json',
        params: {
            'username': 'hua',
            'date': "2016-06-16"
        }
    })

})